package com.lfd.controller;

import java.util.List;

import javax.servlet.http.HttpSession;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.lfd.entity.Infor;
import com.lfd.entity.User;
import com.lfd.service.InformationServise;
import com.lfd.service.UserServise;
import com.lfd.util.Result;
import com.lfd.util.UserUtil;



@Controller
@RequestMapping("/use")
public class InformationController {
	private final Logger logger=Logger.getLogger(InformationController.class);
	@Autowired
	private  InformationServise informationServise;
    @ResponseBody
	@RequestMapping("/zhi")
    public Result su(Infor infor) {
    	List<Infor> su = informationServise.su(infor);
    	return new Result("0", "chenggong",su.size(),su);
    	
    	
    }
    @ResponseBody
	@RequestMapping("/updateUserId")
	public Result updatesu(Infor infor) {
		
		infor.setUserid(UserUtil.getId());
		try {
			informationServise.updatesu(infor);
		} catch (Exception e) {
			// TODO: handle exception
			logger.error("修改失败", e);
			return new Result("1", "修改失败");
		}
		return new Result("0", "修改成功");
		
	}
	
}
